// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: taekwon

#pragma once

#include <experimental/filesystem>
#include <memory>
#include <string_view>

class JsonSchemaImpl;

namespace rapidjson {

template <typename CharType>
struct UTF8;

class CrtAllocator;

template <typename BaseAllocator>
class MemoryPoolAllocator;

template <typename Encoding, typename Allocator, typename StackAllocator>
class GenericDocument;

using Document = GenericDocument<UTF8<char>, MemoryPoolAllocator<CrtAllocator>, CrtAllocator>;
}  // namespace rapidjson

class JsonSchema {
 public:
  explicit JsonSchema(const std::experimental::filesystem::path& path);
  ~JsonSchema();
  bool IsAccept(std::string_view s);
  bool IsAccept(const rapidjson::Document& d);
  void AcceptOrThrow(std::string_view s);
  void AcceptOrThrow(const rapidjson::Document& d);

 private:
  std::unique_ptr<JsonSchemaImpl> impl_;
};
